package com.zuxia.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zuxia.dao.impl.PositDao;
import com.zuxia.dao.impl.StaffDao;
import com.zuxia.entity.Depart;
import com.zuxia.entity.Posit;
import com.zuxia.entity.Staff;
import com.zuxia.service.IStaffService;

@Service("staffService")
public class StaffService implements IStaffService{
	@Resource(name="staffDao")
	private StaffDao staffDao;
	@Resource(name="positDao")
	private PositDao positDao;
	
	public List<Staff> findAll() {
		return staffDao.findAll();
	}
	
	public List<Posit> findPosit(){
		return positDao.findAll();
	};

	@Override
	public String svaeStaff(Staff staff) {
		try {
			staffDao.saveDepart(staff);
			return "yes";
		} catch (Exception e) {
			return "no";
		}
	}


	@Override
	public String updateStaff(Staff staff) {
		try {
			staffDao.updateStaff(staff);
			return "yes";
		} catch (Exception e) {
			return "no";
		}
	}


	@Override
	public String deleteStaff(Staff staff) {

		try {
			staffDao.deleteStaff(staff);
			return "yes";
		} catch (Exception e) {
			return "no1";
		}
	}
}
